/*
 * Created by hql on 2025-07-29 15:32:15
 */

using System.Collections;
using System.Threading.Tasks;
using UnityEngine;

namespace IMMotors
{
    public static class TaskExtensions
    {
        public static IEnumerator AsCoroutine(this Task task)
        {
            while (!task.IsCompleted)
            {
                yield return null;
            }

            if (task.IsFaulted)
            {
                Debug.LogError(task.Exception);
            }
        }
    }
}
